package com.etcfg.etlaunch.ui;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.JFrame;

import com.etcfg.etlaunch.ApplicationSetting;

public class DisplaySettingAction extends AbstractAction {

	private ApplicationSetting settings;
	private JFrame parent;

	public DisplaySettingAction() {
		putValue(Action.NAME, "Settings");
		putValue(Action.SHORT_DESCRIPTION, "Settings");
		putValue(Action.LARGE_ICON_KEY, new ImageIcon(getClass().getResource(
				"/com/etcfg/etlaunch/ui/icons/preferences-system32.png")));
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		SettingsDialog dialog = new SettingsDialog(settings, parent);
		dialog.setLocationByPlatform(true);
		dialog.setLocationRelativeTo(parent);

		dialog.setVisible(true);

	}

	public ApplicationSetting getSettings() {
		return settings;
	}

	public void setSettings(ApplicationSetting settings) {
		this.settings = settings;
	}

	public JFrame getParent() {
		return parent;
	}

	public void setParent(JFrame parent) {
		this.parent = parent;
	}

}
